'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app
  //登录
  router.get('/login', controller.loginController.index)

  //客户信息
  router.get('/customer/index', controller.customerController.index)
  router.post('/customer/create', controller.customerController.create)
  router.post('/customer/update/:id', controller.customerController.update)

  //service
  router.get('/service/index', controller.serviceController.index)
  router.post('/service/create', controller.serviceController.create)
  router.post('/service/update/:id', controller.serviceController.update)
  router.post('/service/delete/:id', controller.serviceController.delete)

  //feature
  router.get('/feature/index', controller.featureController.index)
  router.post('/feature/create', controller.featureController.create)
  router.post('/feature/update/:id', controller.featureController.update)
  router.post('/feature/delete/:id', controller.featureController.delete)

  //account_service
  router.get('/account_service/index/:userId', controller.accountSerController.index)
  router.post('/account_service/create', controller.accountSerController.create)
  router.post('/account_service/update/:id', controller.accountSerController.update)
  router.post('/account_service/delete/:id', controller.accountSerController.delete)

  //account_service_feature
  router.get('/account_service_feature/index/:userId', controller.accountSerFeaController.index)
  router.post('/account_service_feature/create', controller.accountSerFeaController.create)
  router.post('/account_service_feature/update/:id', controller.accountSerFeaController.update)
  router.post('/account_service_feature/delete/:id', controller.accountSerFeaController.delete)

  //factor_group 因子组
  router.get('/factor_group/index', controller.factorGroupController.index)
  router.post('/factor_group/create', controller.factorGroupController.create)
  router.post('/factor_group/update/:id', controller.factorGroupController.update)
  router.post('/factor_group/delete/:id', controller.factorGroupController.delete)
  //所有因子名
  router.get('/factor_group/all_factor', controller.factorGroupController.allFactor)
  //某个组下的因子
  router.get('/factor_group/factor_list/:id', controller.factorGroupController.factorList)
  //更新组下的因子
  router.post('/factor_group/update_factor_group/:id', controller.factorGroupController.updateFactorGroup)
}